﻿using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MvcSample.TagHelpers
{
    public class AntdButtonTagHelper
        : TagHelper
    {
        public string Type { get; set; }
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var tagContent = await output.GetChildContentAsync();
            var content = tagContent.GetContent();

            output.TagName = "button";
            output.Content.SetContent(content);
            output.Attributes.SetAttribute("class", $"btn btn-{Type}");
        }
    }
}
